<?php
/* 
* @Author: LDF QQ 47121862
* @Date:   2014-06-09 11:33:13
* @Last Modified by:   LDF QQ 47121862
* @Last Modified time: 2014-06-09 16:17:26
*/
class CommentControl extends AuthControl{
	//评论列表
	function index(){
		$aid = Q('aid',0,'intval');
		$comment = K('comment')->where(array('aid'=>$aid))->all();
		$this->comment=$comment;
		$this->display();
	}
	//删除评论
	function del(){
		$cid = Q('cid',0,'intval');
		if(M('comment')->del($cid)){
			//更新文章表评论数
			$aid = Q('aid',0,'intval');
			$total = M('comment')->where(array('aid'=>$aid))->count();
			M('article')->save(array('aid'=>$aid,'comments'=>$total));
			$this->success('删除评论成功');
		}else{
			$this->success('删除失败');
		}
		
	}
}
